package com.example.source.spring.bean;

import com.example.source.pojo.FactoryUser;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

@Component
public class FactoryClass implements FactoryBean<FactoryUser> {
    //通过FactoryBean生成bean时，如果需要注入则启动时实例化，没有则等到用到时候实例化
    @Override
    public FactoryUser getObject() throws Exception {
        System.out.println("FactoryClass getObject() called");
        return new FactoryUser();
    }

    @Override
    public Class<FactoryUser> getObjectType() {
        return FactoryUser.class;
    }
}
